NoSQL operator: searchtable

Fast-search of an indexed NoSQL table.

Usage:  searchtable  [options]  table < keytbl
        searchtable  [options]  --index index_file [table] < keytbl

Options:
    --help (-h)
      Print this help info.

    --index (-I) 'file'
      Index file search.

    --no-header (-N)
      Strip table header from output.

    --partial (-p)
      Partial (initial) match. Applies to string type data only.
      Ignored if '-S' is also specified.

    --first-match (-s)
      Only a single row match is needed. Note that due to the binary
      search algorithm being used, the returned match will not
      necessarily be the first occurrence in a sequence of matching
      records.

    --reverse (-v)
      Reverse sort option. File 'table' is sorted in reverse order.

    --test (-t)
      Verify only mode. If an item of info from keytbl is found,
      then an exit code 0 is returned, otherwise the exit code is 1.
      Nothing is printed to STDOUT. Used mainly by a caller process
      for verification.

    --soundex[=n] (-S[n])
      Compute Knuth's soundex codes on values in input 'keytbl' and
      search for those codes as opposed to searching for their literal
      values. It is assumed that the table (or the index) being searched
      is also built on soundex codes as opposed to literal strings.
      If 'n' is not specified, it defaults to the standard soundex code
      length of four characters.

    --debug (-x)
      Debug option.

Notes:

This operator does a fast search of 'table' (or index_file) using a binary
search on a key of of one or more columns. The 'table' (or index_file) must
be sorted on the key columns.  Each column in the key may be of type string
or type numeric (but be careful with numeric data and exact matches). In the
second form of usage for this operator, if 'table' is not given, its name will
be inferred from the name of index_file. For example if index_file is
'skb._x.typ' then the table name inferred will be 'skb'. This mechanism of
deriving limited pieces of key-related information from file names dates
back to when a true Database Schema had not yet been introduced in NoSQL,
and it is still used by those parts of NoSQL's code that have not yet been
amended to read the actual schema table.

The column(s) in the file 'keytbl' specify both the key column name(s) and the
argument values to search for. File 'keytbl' is in table format.

Normally an argument value and a data field must compare exactly for a match 
to occur (exact match). If the partial match option (--partial) is selected
and if the argument value compares with the initial part of the data field, it
is considered a match. This applies to string type data only. Note that for
numeric type data an exact match is always necessary.

Normally all rows that match will be written to the new table in the same
order as in the old table. If only a single row key match is appropriate
some execution time can be saved by specifing the '--first-match' option.

This operator writes a table to STDOUT and returns the number of non-finds
at exit.
Back